<?php
namespace app\type\model;

use think\Model;
use think\Db;

class TypeModel extends Model
{
    public function addType($type)
    {
        $res = Db::name('type')->insert($type);
        return $res;
    }

    public function delType($id)
    {
        $res = Db::name('type')->where('type_id', 'in', $id)->delete();
        return $res;
    }

    public function upType($type)
    {
        $res = Db::name('type')->where('type_id', $type['type_id'])->update($type);
        return $res;
    }

    public function getType($type)
    {
        $res = Db::name('type')->where($type)->select();
        return $res;
    }
}
